package cn.zktr.Personnel.model.service.zhouyongcong.end;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.zktr.Personnel.model.pojos.PerPmsDept;
import cn.zktr.Personnel.model.pojos.PerPmsEmp;
import cn.zktr.Personnel.model.pojos.PerPmsPot;
import cn.zktr.Personnel.model.pojos.PerPmsStm;
import cn.zktr.Personnel.model.pojos.PerPmsZhiji;
import cn.zktr.Personnel.model.service.zhouyongcong.findService;
import cn.zktr.Personnel.model.service.zhouyongcong.monit.monitgetService;

@Service
@Transactional(rollbackFor=Exception.class)
public class socialService {
	
	@Autowired
	private findService fs;
	@Autowired
	private monitgetService mgs;
	
	public List<PerPmsEmp> Bel_wle(Integer empid) {
		PerPmsEmp ppe = fs.findEmpid(empid);
		PerPmsDept ppd = ppe.getPerPmsStms().get(0).getPerPmsDept();
		List<PerPmsEmp> L_ppe = new ArrayList<PerPmsEmp>();
		if(ppd.getPerPmsMgms().get(0).getPerPmsEmp()==ppe) {
			PerPmsZhiji ppzj = ppe.getPerPmsStms().get(0).getPerPmsPot().getPerPmsZhiji();
			for(PerPmsPot ppp : ppzj.getPerPmsPots()) {
				if(ppp.getPerPmsStms().size()!=0) {
					PerPmsStm pps = ppp.getPerPmsStms().get(0);
					PerPmsEmp pe = pps.getPerPmsEmp();
					if(!pps.getPerPmsEmp().equals(ppe)) {
						L_ppe.add(pe);
					}
				}
			}
		}
		for(PerPmsStm pps : ppd.getPerPmsStms()) {
			PerPmsEmp pe = pps.getPerPmsEmp();
			if(!pps.getPerPmsEmp().equals(ppe)) {
				L_ppe.add(pe);
			}
		}
		System.err.println(L_ppe.size());
		return L_ppe;
	}
}
